<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="contain">
        <school></school>
    </div>

    <div id="root">
        <hello></hello>
    </div>

    <script>
        //局部组件
        const a = Vue.extend({
            data() {
                return {
                    name: 'lili',
                    age: '17',
                    school: 'gyyz'
                }
            },
            template: `
            <div>
            <h2>测试</h2>
            </div>
            `
        })

        const hello = Vue.extend({

            template: `
            <div>
            <h2>{{name}}</h2>
            </div>   
            `,
            data() {
                return {
                    name: 'lili2',
                }
            }
        })


        //全局组件
        Vue.component('hello', hello)

        //vm实例
        new Vue({
            el: '#contain',
            data: {

            },
            components: {
                school: a
            }
        });

        new Vue({
            el: '#root'
        });
    </script>
</body>

</html>